<template>
  <div class="goods">
    <div class="gooda_content">
      <i class="iconfont icon-fanhui" @click="$router.go(-1)"></i>
      <h3>商品搜索</h3>
    </div>
    <Search />
    <ul class="last_content">
      <li v-for="item in getArr" :key="item.id" @click="$router.push('/jia')">
        <img :src="item.goodsLogo" alt="" />
        <p>{{ item.goodsName }}</p>
        <span class="one"
          ><del>{{ item.goodsOldPrice }}</del></span
        >
        <span class="two"> ￥{{ item.goodsPrice }} </span>
        <span class="three"
          ><img class="im1" src="../../assets/images/collect.png" alt="" /><i>{{
          item.hot
          }}</i></span
        >
      </li>
    </ul>
  </div>
</template>

<script>
import Search from "@/components/home/Search.vue";
import { GoodsApi } from "@/request/api";
export default {
  data() {
    return {
      getArr: [],
      goodsName: "",
    };
  },
  components: {
    Search,
  },
  created() {
    let goodsName = this.$route.params.sp_home_title;

    console.log(goodsName);
    GoodsApi({
      goodsName: goodsName,
    }).then((res) => {
      console.log(res);
      this.getArr = res.data.data;
      console.log(this.getArr);
      // this.goodsName=goodsName
      // console.log(this.goodsName);
    });
  },
};
</script>
 
<style lang = "less" scoped>
.gooda_content {
  display: flex;
  margin-top: 20px;
  margin-bottom: 20px;
  i {
    margin-left: 20px;
  }
  h3 {
    margin-left: 38vw;
  }
}
.last_content {
  display: flex;
  justify-content: space-around;
  flex-flow: wrap;
  padding: 0.4vw;
  background-color: #f7f8fa;
  li {
    //   flex: 1;
    background-color: #fff;
    width: 48%;
    flex-flow: wrap;
    min-width: 0;
    margin-bottom: 10px;
    img {
      width: 48vw;
      border-radius: 1.2vw;
      // margin-top: 10px;
    }
    p {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin-bottom: 0.08vw;
      font-size: 1.6vw;
      color: #000;
      line-height: 20px;
    }
    .one {
      margin-right: 5.33334vw;
      color: #dcdcdc;
      font-size: 1.6vw;
    }
    .two {
      color: red;
      font-size: 1.6vw;
      margin-right: 2.666667vw;
    }
    .im1 {
      width: 3.133333vw;
      height: 3.133333vw;
      margin-right: 0.333333vw;
    }
    i {
      font-size: 1.6vw;
      margin-left: 10px;
    }
    .three {
      margin-bottom: 10px;
      float: right;
    }
  }
}
</style>